<template>
  <div class="addForm">
    <el-dialog
      title="新建预排订单"
      :visible.sync="dialogVisible"
      width="50%"
      :before-close="handleClose"
    >
      <el-form class="form" :model="form" inline label-position="top">
        <el-form-item label="预排订单号">
          <el-input
            v-model="form.orderNum"
            disabled
            placeholder="系统自动生成"
          ></el-input>
        </el-form-item>
        <el-form-item label="客户名称">
          <el-input v-model="form.name" placeholder="请填写"></el-input>
        </el-form-item>
        <el-form-item label="产品类别">
          <el-select v-model="form.type" placeholder="请选择">
            <el-option label="" value=""></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="产品名称">
          <el-input v-model="form.product" placeholder="请填写"></el-input>
        </el-form-item>
        <el-form-item label="客户需求量(件)">
          <el-input v-model="form.quantity" placeholder="请填写"></el-input>
        </el-form-item>
        <el-form-item label="订单交期">
          <el-date-picker
            v-model="form.time"
            type="date"
            placeholder="选择日期"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="业务部门">
          <el-select v-model="form.department" placeholder="请选择">
            <el-option label="" value=""></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="业务员">
          <el-select v-model="form.clerk" placeholder="请选择">
            <el-option label="" value=""></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="是否整单外协">
          <el-select v-model="form.outside" placeholder="请选择">
            <el-option label="" value=""></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="外协工厂">
          <el-select v-model="form.outsourcedFactory" placeholder="请选择">
            <el-option label="" value=""></el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="dialogVisible = false"
          >确 定</el-button
        >
      </span>
    </el-dialog>
  </div>
</template>

<script>
export default {
  props: {
    value: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {
      dialogVisible: false,
      form: {},
    };
  },
  watch: {
    value(val) {
      if (val && val !== this.dialogVisible) {
        this.dialogVisible = val;
        if (val) {
          //   this.selectRows = {}
          //   this.$refs?.table?.$refs?.myTable.setCurrentRow()
        }
      }
    },
    dialogVisible(val) {
      this.$emit("input", val);
    },
  },
  created() {},
  mounted() {},
  methods: {
    handleClose() {
      this.dialogVisible = false;
    },
  },
};
</script>

<style scoped lang="scss">
.form {
  display: flex;
  flex-wrap: wrap;
  .el-form-item {
    width: 50%;
    margin-right: unset;
    padding-right: 15px;
  }
  .el-select {
    width: 100%;
  }
  .el-date-editor {
    width: 100%;
  }
}
</style>
